@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

/* 强制显示滚动条以确保所有页面布局一致 */
html {
  overflow-y: scroll;
}

:root {
  /* Binance Brand Colors */
  --brand-yellow: #f0b90b;
  --brand-black: #000000;
  --brand-dark-gray: #0a0a0a;
  --brand-light-gray: #eaecef;
  --brand-almost-white: #fafafa;
  --brand-white: #ffffff;

  /* Binance Theme Colors */
  --binance-yellow: #f0b90b;
  --binance-yellow-dark: #c99400;
  --binance-yellow-light: #fcd535;
  --binance-yellow-glow: rgba(240, 185, 11, 0.2);

  --background: #000000; /* Binance body bg */
  --header-bg: #000000; /* Binance header bg */
  --background-elevated: #000000;
  --foreground: #eaecef;
  --panel-bg: #0a0a0a;
  --panel-bg-hover: #111111;
  --panel-border: #1a1a1a;
  --panel-border-hover: #2a2a2a;

  /* Binance Signature Colors */
  --binance-green: #0ecb81;
  --binance-green-bg: rgba(14, 203, 129, 0.1);
  --binance-green-border: rgba(14, 203, 129, 0.2);
  --binance-red: #f6465d;
  --binance-red-bg: rgba(246, 70, 93, 0.1);
  --binance-red-border: rgba(246, 70, 93, 0.2);

  /* UI Colors */
  --text-primary: #eaecef;
  --text-secondary: #848e9c;
  --text-tertiary: #5e6673;
  --text-disabled: #474d57;

  /* Chart Colors */
  --grid-stroke: #1a1a1a;
  --axis-tick: #5e6673;
  --ref-line: #474d57;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);

  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  line-height: 1.6;
  font-weight: 400;
  color-scheme: dark;
  color: var(--foreground);
  background-color: var(--background);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: var(--background);
}

#root {
  width: 100%;
  margin: 0 auto;
}

/* Scrollbar - Binance style */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background);
}

::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 4px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--panel-border-hover);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 8px currentColor;
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 16px currentColor;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes pulse-scale {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
  animation: slideIn 0.4s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out;
}

.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* Glass effect - Binance header style */
.header-bar {
  background: var(--header-bg);
  border-bottom: 1px solid var(--panel-border);
}

/* Sonner (toast) - Binance theme overrides */
.sonner-toaster {
  z-index: 9999;
}

.nofx-toast {
  background: #0b0e11 !important;
  border: 1px solid var(--panel-border) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-lg) !important;
  border-radius: 6px !important;
}

.nofx-toast .sonner-title {
  color: var(--text-primary) !important;
  font-weight: 700;
}

.nofx-toast .sonner-description {
  color: var(--text-secondary) !important;
}

/* Success / Error / Warning tint */
.nofx-toast[data-type='success'] {
  background: #0b0e11 !important;
  border-color: var(--binance-green) !important;
  border-left: 3px solid var(--binance-green) !important;
}
.nofx-toast[data-type='success'] .sonner-title,
.nofx-toast[data-type='success'] .sonner-description {
  color: var(--binance-green) !important;
}

.nofx-toast[data-type='error'] {
  background: #0b0e11 !important;
  border-color: var(--binance-red) !important;
  border-left: 3px solid var(--binance-red) !important;
}
.nofx-toast[data-type='error'] .sonner-title,
.nofx-toast[data-type='error'] .sonner-description {
  color: var(--binance-red) !important;
}

.nofx-toast[data-type='warning'],
.nofx-toast[data-type='info'] {
  background: #0b0e11 !important;
  border-color: var(--binance-yellow) !important;
  border-left: 3px solid var(--binance-yellow) !important;
}
.nofx-toast[data-type='warning'] .sonner-title,
.nofx-toast[data-type='warning'] .sonner-description,
.nofx-toast[data-type='info'] .sonner-title,
.nofx-toast[data-type='info'] .sonner-description {
  color: var(--binance-yellow) !important;
}

.nofx-toast .sonner-close-button {
  color: var(--text-secondary) !important;
}
.nofx-toast .sonner-close-button:hover {
  color: var(--text-primary) !important;
}

/* Monospace numbers */
.mono {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

/* Button styles - Binance */
button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
}

button:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: scale(0.98) translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Binance Card - Enhanced */
.binance-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.dev-toast-controller {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(320px, 85vw);
  background: rgba(11, 14, 17, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  color: var(--text-secondary);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(16px);
  font-size: 0.85rem;
  z-index: 9999;
}

.dev-toast-controller__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.dev-toast-controller__header small {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.dev-toast-controller__content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dev-toast-controller__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.dev-toast-controller__label select,
.dev-toast-controller__label input {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--panel-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.dev-toast-controller__actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.dev-toast-controller__actions button {
  flex: 1;
  cursor: pointer;
  border-radius: 999px;
  padding: 8px 10px;
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.dev-toast-controller__actions button:first-child {
  background: rgba(240, 185, 11, 0.15);
  color: var(--binance-yellow);
  border: 1px solid rgba(240, 185, 11, 0.4);
}

.dev-toast-controller__actions button:last-child {
  background: rgba(132, 142, 156, 0.15);
  color: var(--text-secondary);
  border: 1px solid var(--panel-border);
}

.dev-toast-controller__actions button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.dev-custom-toast {
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0b90b, #df8c0c);
  color: #0a0a0a;
  font-weight: 600;
}

.dev-custom-title {
  margin: 0;
  font-size: 1rem;
}

.dev-custom-body {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.binance-card:hover {
  border-color: var(--panel-border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.binance-card-no-hover {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
}

/* Binance gradient backgrounds */
.binance-gradient {
  background: linear-gradient(
    135deg,
    var(--binance-yellow) 0%,
    var(--binance-yellow-light) 100%
  );
}

.binance-gradient-subtle {
  background: linear-gradient(
    135deg,
    rgba(240, 185, 11, 0.15) 0%,
    rgba(252, 213, 53, 0.05) 100%
  );
  border: 1px solid rgba(240, 185, 11, 0.2);
}

.binance-glow {
  box-shadow: 0 0 20px var(--binance-yellow-glow);
}

/* Status colors */
.text-profit {
  color: var(--binance-green);
  font-weight: 700;
}

.text-loss {
  color: var(--binance-red);
  font-weight: 700;
}

.bg-profit {
  background-color: var(--binance-green-bg);
  color: var(--binance-green);
  border: 1px solid var(--binance-green-border);
}

.bg-loss {
  background-color: var(--binance-red-bg);
  color: var(--binance-red);
  border: 1px solid var(--binance-red-border);
}

/* Skeleton loading */
.skeleton {
  background: var(--panel-bg);
  background-image: linear-gradient(
    90deg,
    transparent,
    rgba(240, 185, 11, 0.05),
    transparent
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Binance button variants */
.btn-binance {
  background: var(--binance-yellow);
  color: #000;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  padding: 0.625rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(240, 185, 11, 0.3);
}

.btn-binance:hover {
  background: var(--binance-yellow-light);
  box-shadow: 0 4px 8px rgba(240, 185, 11, 0.4);
  transform: translateY(-2px);
}

.btn-binance:active {
  background: var(--binance-yellow-dark);
  transform: translateY(0);
}

.btn-outline {
  background: transparent;
  color: var(--binance-yellow);
  border: 1.5px solid var(--binance-yellow);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.btn-outline:hover {
  background: rgba(240, 185, 11, 0.1);
  border-color: var(--binance-yellow-light);
}

/* Table styles - Binance */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 0;
}

td {
  color: var(--text-primary);
  padding: 0.75rem 0;
}

tr {
  border-bottom: 1px solid var(--panel-border);
  transition: background 0.2s ease;
}

tr:last-child {
  border-bottom: none;
}

tr:hover {
  background: rgba(240, 185, 11, 0.03);
}

/* Badge/Chip styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid;
  transition: all 0.2s ease;
}

.badge-yellow {
  background: rgba(240, 185, 11, 0.1);
  border-color: rgba(240, 185, 11, 0.3);
  color: var(--binance-yellow);
}

.badge-green {
  background: var(--binance-green-bg);
  border-color: var(--binance-green-border);
  color: var(--binance-green);
}

.badge-red {
  background: var(--binance-red-bg);
  border-color: var(--binance-red-border);
  color: var(--binance-red);
}

/* Number formatting */
.number-up {
  color: var(--binance-green);
}

.number-down {
  color: var(--binance-red);
}

.number-neutral {
  color: var(--text-secondary);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--panel-border);
  margin: 1rem 0;
}

/* Tooltip style */
.tooltip {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 0.75rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

/* Loading spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  border: 2px solid var(--panel-border);
  border-top-color: var(--binance-yellow);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.6s linear infinite;
}

/* Stat card enhancements */
.stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 1.25rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--binance-yellow),
    transparent
  );
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover {
  border-color: rgba(240, 185, 11, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

/* Chart container */
.chart-container {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* Responsive utilities */
@media (max-width: 768px) {
  .binance-card {
    padding: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }
}
